<?php
namespace Apps\BoxEdu\Model;

use Think\Model;

class EduClassroomsBookModel extends \BaseModel {
	public function load($id = "") {
		$data = $this->find($id);
		if (!$data) {
			return false;
		}
		$part_id = $data['part_time_id'];
		//dump($data);
		$info = BoxModel("edu_classrooms_subject")->where(array('id' => $part_id))->find();
		if (is_array($info)) {
			$subject = BoxModel("edu_subject")->where(array('subjectid' => $info['subjectid']))->find();
			$classrooms = BoxModel("edu_classrooms")->where(array('id' => $info['class_room_id']))->find();
			$data['name'] = $classrooms['name'];
			$data['offline_subject_name'] = $subject['subject'];
			$data['info'] = $info['week_str'] . $info['lable'];
		} else {
			$subject = BoxModel("edu_subject")->where(array('subjectid' => $data['subjectid']))->find();
			$data['offline_subject_name'] = $subject['subject'];
			$data['name'] = $data['name'];
		}
		$students = BoxModel("edu_students")->where(array('user_id' => $data['user_id']))->find();
		$schools = BoxModel("edu_schools")->where(array('id' => $data['school_id']))->find();
		$data['qq'] = $students['qq'];
		$data['mobile'] = $students['mobile'];
		$data['real_name'] = $students['real_name'];
		$seat_num = explode("_", $data['seat_num']);
		$data['school_name'] = $schools['name'];
		$data['seat_num'] = "第" . $seat_num['0'] . "排 第" . $seat_num['1'] . "列";

		//dump($info['class_room_id']);
		//dump($classrooms);
		//$data['area'] = BoxModel("SystemArea")->load($data['province_id']);
		//$data['class'] = BoxModel("EduClassrooms")->load($data['classroom_id']);
		//$data['school'] = BoxModel("EduSchools")->load($data['school_id']);
		//$data['user'] = BoxModel("SystemMember")->load($data['user_id']);
		return $data;
	}

}
